/*
 * Created on Jan 12, 2005
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License");  you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * http//www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The Original Code is MAPONTO.
 *
 * The Initial Developer of the Original Code is University of Toronto. Portions
 * created by University of Toronto are Copyright (C) 2004.  All Rights Reserved.
 *
 * MAPONTO was developed by Knowledge Management Lab
 * (http//www.cs.toronto.edu/km) at the University of Toronto Department of 
 * Computer Science. Current information about MAPONTO can be obtained at 
 * http//resi.ai.toronto.edu:8080
 *
 */
package main.model;

import java.io.Serializable;
import java.util.ArrayList;

import edu.stanford.smi.protegex.owl.model.OWLClass;

/**
 * @author yuana
 *
 *Synopsis: the restrictions of a class extracted from its superClasses.
 *Restrictions: maxCardinality, minCardinality,  allValueFrom, and
 *someValueFrom.
 */
public class ClsRestriction implements Serializable{
	private Cardinality cardi;
	private ArrayList<OWLClass> targets;
	private boolean used;
	
	public ClsRestriction(){
		cardi=null;
		targets=new ArrayList<OWLClass>();
		used=false;
	}
	
	public void setUpperCardi(int card){
		if(cardi==null)
			cardi=new Cardinality();
			
		cardi.setUpper(card);
	}
	
	public void setLowerCardi(int card){
		if(cardi==null)
			cardi=new Cardinality();
		
		cardi.setLower(card);	
	}
	
	public Cardinality getCardi(){
		return cardi;
	}
			
	public void addTarget(OWLClass t){
		if(!targets.contains(t))
			targets.add(t);
	}
	
	public ArrayList<OWLClass> getTargets(){
		return targets;
	}
	
	public void setUsed(){
		used=true;
	}
	
	public boolean isUsed(){
		return used;
	}
}
